package cn.itcast.dewu.utils;

import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;

public class OSSFactory {
    public static  <T> T getConfigObject(Class<T> clazz) {
        String qiNiu = "{\"qiniuAccessKey\":\"3bAIkwszxzWVUczBQRNzi_5gMOBAEuvfwqUwaIOH\",\n" +
                "\"qiniuBucketName\":\"alwaysying\",\n" +
                "\"qiniuDomain\":\"rb1oc9tg0.hn-bkt.clouddn.com\",\n" +
                "\"qiniuPrefix\":\"dewu\",\n" +
                "\"qiniuSecretKey\":\"mB_kT9DbUy6wY67uVgx4F64lCEDOlUhtv5pKrU0H\",}";
        if(StringUtils.isNotBlank(qiNiu)){
            return JSONUtil.toBean(qiNiu, clazz);
        }
        try {
            return clazz.newInstance();
        } catch (Exception e) {
            throw new RuntimeException("获取参数失败");
        }
}
}
